home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ISO_SRC.ZIP / LIBRARY.ZIP / LIBRARY.TXT < prev    next >
Encoding:
Text File  |  1996-06-08  |  3.6 KB  |  104 lines

  1.                        JIM ADAMS LIBRARY ARCHIVE '96
  2.             Copyright (c) 1996 by Jim Adams, All right reserved.
  3.  
  4.          The author, Jim Adams, gives full permission to duplicate
  5.             these files only for personal use. This may only be
  6.              duplicated with all the files, including this one.
  7.            No part of this file may be published without prior
  8.                     written permission by the author.
  9.  
  10.  
  11. Hello!
  12.  
  13.   Contained within is my custom libraries I use for both my BORLAND
  14. and WATCOM compilers.  These work by typing as the first line depending
  15. on your compiler:
  16.  
  17. #define COMPILER_BORLAND
  18. or
  19. #define COMPILER_WATCOM
  20.  
  21.   Why not use __BORLANDC__ or __WATCOMC__ you ask?  Well you should
  22. not assume a compiler you're using has a preset definition like that.
  23. I make my libraries work on a multitude of systems and OS's just by
  24. replacing a little bit of code.
  25.  
  26.   Anyways, the following files are contained: (all are for 320x200x256color)
  27.  
  28. VIDEO.C        All functions for handling video modes, palettes, etc.
  29. FONT.C         Font printing to graphics screen
  30. BLOCK.C        Tile block drawing
  31. PCX.C          Pcx loading and saving routines
  32. KEYTRAP.C      Keyboard interrupt services for multiple keypress's
  33.  
  34.  
  35. A listing of important functions:
  36. VIDEO.C:
  37.    -  gfx_screen is a pointer to the video screen.
  38.       To set a pixel at 0x0 with color 15: gfx_screen[0]=15;
  39.       or copy a offscreen buffer to screen: memcpy(gfx_screen,buf,64000);
  40.  
  41.    -  setvmode sets a video mode.
  42.       for 320x200x256color:  setvmode(0x13);
  43.       and back to text mode: setvmode(0x03);
  44.  
  45.    -  palette_set will set a palette passed to it
  46.       palette_set(palette,border_color,num_colors);
  47.  
  48.    -  palette_get will read a palette into a buffer from the video
  49.       palette_get(palette);
  50.  
  51.    -  display_screen wil blit a buffer to video screen
  52.       display_screen(offscreen_buffer);
  53.  
  54.    -  clear_screen will clear a buffer to selected color
  55.       clear_screen(offscreen_buffer,0);
  56.  
  57. FONT.C
  58.    -  font_printxy will print a string at cords supplies
  59.       font_printxy(gfx_screen,0,0,"Hello!");
  60.       NOTE: This function has the following embeded commands:
  61.             These are preceeded by the '/' character.
  62.  
  63.             /b : sets the background draw color  256 = transparent
  64.             /t : sets the text draw color
  65.             /n : is a form feed
  66.             /r : is a carriage return
  67.             /N : is form feed and carriage return
  68.  
  69. BLOCK.C
  70.    -  block_clip finds a graphic retangle on the buffer provided and clips it
  71.       (char*)block = block_clip(gfx_screen);
  72.  
  73.    -  block_clip2 clips a block at x,y with a width and height
  74.        (char*)block = block_clip2(gfx_screen,x,y,width,height);
  75.  
  76.    -  block_draw will draw a captured block to a buffer
  77.       block_draw((char*)block,x,y,gfx_screen);
  78.  
  79. PCX.C
  80.    -  pcx_load loads a 320x200 pcx file into a buffer and palette
  81.       pcx_load("file.pcx",pcx_buffer,pcx_palette);
  82.  
  83.    -  pcx_save saves a 320x200 pcx file from a buffer and palette
  84.       pcx_save("file.pcx",pcx_buffer,pcx_palette);
  85.  
  86. KEYTRAP.C
  87.    -  key_press is an array of the keys currently pressed or released
  88.       these are arrayed by scan code
  89.       to check for a ESC press
  90.       if(key_press[1]) { }
  91.  
  92.    -  key_lock allows for one-shot keypress's.  Just clear the keypress
  93.       and set the key_lock to one.
  94.       to lock the ESC key:
  95.       if(key_press[1]) {
  96.         key_lock(1);
  97.       }
  98.  
  99.    -  key_trap will trap the keyboard for our use
  100.       key_trap();
  101.  
  102.    -  key_untrap will release keyboard control back to former handler
  103.       key_untrap();
  104.